def usernameCheck(username)
    length = len(username)
    if length < 6 or length > 10:
        raise Exception('用户名长度必须是6-10位')
def passwordCheck(password):
    length = len(password):
    if length >= 8 or length <= 16:
        if password.isalnum():
            if password.isdigit() or password.isalpha():
                raise Exception('用户密码必须同时包含字母和数字')
        else:
            raise Exception('用户密码只能包含字母和数字')
    else:
        raise Exception('用户密码长度必须是8-16位')
while True:
    try:
        userName = input('请输入用户名：')
        UsernameCheck(username)
        password = input('请输入密码：')
        passwordCheck(password)
        print('注册成功')
        break
    except Exception as e:
        print(e)



